﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<t_205_verk_hopur_12.Models.ChannelEmployeesViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Starfsmenn
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% if (Model.Employees.Count() == 0)
   { %>
    <h3>Engir starfsmenn eru skráðir á þessari stöð</h3>
    <p>&nbsp;</p>
    <%= Html.ActionLink("Til baka", "Index", "Channel", new { id = Model.Channel.ID }, null)%>
    <%}
   else
   { %>
    <h2>Starfsmenn</h2>

    <table class="NeatTable">
        <tr>
            <% if (Model.IsOwner)
            {%>
            <th></th>
            <% } %>
            <th>
                Notendanafn
            </th>
            <th>
                Tölvupóstfang
            </th>
            <th>
                Aldur
            </th>
            <th>
                Kyn
            </th>
        </tr>

    <% foreach (var item in Model.Employees)
       { %>
    
        <tr>
            <% if (Model.IsOwner)
               {%>
            <td>
                <%= Html.ActionLink("Reka", "FireEmployee", new { id = Model.Channel.ID, userID = item.ID })%>
            </td>
            <% } %>
            <td>
                <%= Html.Encode(item.Username)%>
            </td>
            <td>
                <%= Html.Encode(item.Email)%>
            </td>
            <td>
                <%= Html.Encode(item.Age)%>
            </td>
            <td>
                <%if (item.Gender == true)
                  { %>
                     Karl
                <% } %>
                <% else
                   { %>
                     Kona
                <% } %>
            </td>
        </tr>
    
    <% } %>

    </table>
    <% } %>
    
       <% if (!Model.IsOwnerOrEmployee)
           { %>
        <div id="Application">
            <p>
            <% if (Page.User.Identity.Name != "")
               { %>
                <%if (!Model.HasAppliedToChannel)
                  {%>
                <%= Ajax.ActionLink("__IMGREPLACE__ Sækja um starf á stöðinni", "Apply", "Channel", new { id = Model.Channel.ID }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "Application" }).ToString().Replace("__IMGREPLACE__", "<img src='/Content/Icons/group_add.png' alt='Sækja um' title='Sækja um' />")%>
                <%}
                  else
                  { %>
                 (Umsókn þín er í vinnslu)
                 <%} %>
                 <%} %>
            </p>
            <p>&nbsp;</p>
        </div>
        <% } %>

</asp:Content>


<asp:Content ID="Content3" ContentPlaceHolderID="LogoText" runat="server">
    <%= Html.ActionLink(Model.Channel.Name, "Index", new { id = Model.Channel.ID }) %>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="MenuBar" runat="server">
    <% Html.RenderPartial("AdminChannelMenuBar", Model.Channel); %>
</asp:Content>

